import request from '@/utils/request'

/**
 * 获取角色列表
 */
export const getRoleListApi = (data) => {
  return request({
    method: 'GET',
    url: '/sys/role',
    params: data
  })
}

/**
 * 删除角色
 */
export const delRoleApi = (id) => {
  return request({
    method: 'delete',
    url: `/sys/role/${id}`
  })
}

/**
 * 新增角色
 */
export const addRoleApi = (data) => {
  return request({
    method: 'post',
    url: '/sys/role',
    data
  })
}

/**
 * 获取详情！数据回显
 */
export const getRoleDetailApi = (id) => {
  return request({
    url: `/sys/role/${id}`
  })
}

/**
 * 修改角色
 */

export const editRoleApi = (data) => {
  return request({
    method: 'put',
    url: `/sys/role/${data.id}`,
    data
  })
}

/**
 * 修改分配权限
 */

export const AssignPermissionApi = data => {
  return request({
    method: 'put',
    url: '/sys/role/assignPrem',
    data
  })
}
